home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-08-12 | 2.0 KB | 47 lines | [TEXT/R*ch] |
- Scroll Over by Bob Ebert
-
- Demonstrates scrolling of views (clPictureViews in this case) using two methods.
-
-
- Method one uses a custom scrolling control which calls SetOrigin() on a clipping
- view to move the contents of the view around. The clipping window also has a
- viewClickScript which tracks the pen and scrolls the contents as the user drags.
- (The view method :Drag() isn’t equipped to do this.)
-
- The dragging is interesting and perhaps useful, as long as you don’t need to click
- on the scrolled contents or write over them. It’s also non-intuitive, and should
- only be used in conjunction with a scroller control.
-
- The scroller control itself has several things hardcoded that might better be
- gotten dynamically. It was not intended as a generic scrolling utility, but
- rather an example to illustrate how to do local scrolling of a view.
-
- In the sample, the scroller control bitmap for the top window comes from a
- resource file. This image is available in the system rom, and could be gotten
- at runtime via ROM_canonicalCompass.icon. (This won’t evaluate at compile time!)
- I chose to stick with a resource so that the controll image could be swapped.
-
-
- Method two uses the proto that the Newton electronic book reader has provided
- to do all the work. This is handy, because you have to do almost nothing to
- make a view scroll. With this method, you need to do the following:
-
- set the scrolledView slot in the canonicalCompass control to the view
- to be scrolled.
- make sure the view to be scrolled has the following slots:
- dataBounds (a viewBounds slot which controls scrolling limits)
- viewOriginX
- viewOriginY
-
- In the sample code, all these are done within the viewSetupDoneScript of the
- picture view which is scrolled.
-
- This is probably the preferred method, since it’s so lightweight in RAM and
- programming requirements, plus it guarantees a consistent user interface.
-
-
- Note that the top example will scroll diagonally using the scroller controll,
- while the bottom one (using the book proto) doesn’t. <shrug>
-
- --Bob
-